'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  router.get('/', controller.home.index);


  router.get('/qm/v1/ad/:id', controller.weshop.ad.show);
  router.get('/qm/v1/insertad', controller.weshop.ad.insert);

  router.get('/v1/pn/login', controller.user.login);

  router.post('/v1/pa/logout', controller.user.logout);

  //用户信息
  router.get('/v1/pa/userinfo', controller.user.info);
  //账户信息
  router.get('/v1/pa/useraccount', controller.company.account);
  //更新微信账户信息
  router.post('/v1/pa/updateweixinconfig', controller.company.updateWeixinConfig);

  //手机端设置redis注册成功
  router.post('/v1/ua/setregistersuccess', controller.company.setRegisterSuccess);
  //pc端
  router.post('/v1/pa/getregisterstate', controller.company.getRegisterState);
  //图形验证码
  router.post('/v1/pn/getimagecode', controller.file.getImageCode);
  //判断手机号是否已经注册了。
  router.post('/v1/pn/getinfobymobile', controller.user.getInfoByMobile);
  //发送验证码
  router.post('/v1/pn/setregistersmscode', controller.file.setRegisterSmsCode);
  //获得验证码
  router.post('/v1/pn/getregistersmscode', controller.file.getRegisterSmsCode);
  //获得用户的注册步骤信息
  router.get('/v1/pa/getstep', controller.user.getStep);
  //向商家支付,code:订单编号
  router.post('/v1/pn/createorder4merchant', controller.weixin.createOrder4Merchant);
  //支付完成后的一次性订阅消息
  router.get('/v1/pn/ordermsg', controller.weixin.orderMsg);
  //一次性订阅消息的回调
  router.get('/v1/pn/ordermsgcallback', controller.weixin.orderMsgCallback);
  //重发短信
  router.post('/v1/pa/resendsms', controller.order.resendSMS);
  //检查密码是否正确
  router.post('/v1/pa/checkpass', controller.user.checkPass);
  //修改密码
  router.post('/v1/pa/modifypass', controller.user.modifyPass);

  //上传
  router.post('/v1/pn/upload', controller.upload.index);

  //查询短信
  router.post('/v1/pa/smsinfo', controller.sms.info);


  router.get('/v1/pa/products', controller.product.list);
  router.get('/v1/ua/products', controller.product.list);

//会员登录
  router.get('/v1/un/checkneedauth', controller.member.checkNeedAuth);
  router.get('/v1/un/auth', controller.member.auth1);
  router.get('/v1/un/getwxcode', controller.member.getwxcode);
  router.get('/v1/un/test', controller.member.test);
  router.get('/v1/un/test1',controller.member.test1);


  router.get('/v1/un/mnlogin',controller.member.mnlogin);

//支付授权
  router.get('/v1/un/checkpayneedauth', controller.member.checkPayNeedAuth);
  router.get('/v1/un/payauth', controller.member.payauth);
  router.get('/v1/un/paygetwxcode', controller.member.paygetwxcode);

//提现授权
  router.get('/v1/un/checkcashneedauth', controller.member.checkCashNeedAuth);
  router.get('/v1/un/cashauth', controller.member.cashauth);
  router.get('/v1/un/cashgetwxcode', controller.member.cashgetwxcode);
  


  //获取微信签名字符串，company_code
  router.post('/v1/wn/configinfo', controller.weixin.configinfo);
  router.post('/v1/wn/createorder', controller.weixin.createOrder);



  router.post('/wxpaycallback', controller.weixin.paycallback);
  router.post('/wxrefundcallback', controller.weixin.refundcallback);


  router.get(/(\w*)\.txt$/, controller.file.detail);


//微信权限验证文件
  router.get('/MP_verify_T1LLNeCSL4P8T9Bw.txt', controller.member.file);
  router.get('/MP_verify_C1p4Fbrbhy6sGK3J.txt', controller.member.file1);
  //商客创易
  router.get('/MP_verify_Whv6QEeRIBYh4ekU.txt', controller.file.shangkechuangyi);

//https验证文件
  router.get('/.well-known/pki-validation/fileauth.txt', controller.file.auth);


  router.get('/apiclient_cert.p12', controller.file.apiclientCert);


  //测试用的
  
  router.post('/v1/un/sms', controller.sms.send);
  router.get('/v1/un/companyinfo', controller.company.info);
  router.get('/v1/un/companytoredis', controller.company.toRedis);
  //手动调用更新token定时任务。
  router.get('/v1/un/settoken', controller.weixin.setToken);


  router.get('/v1/un/gettokenfromjuyou', controller.common.getTokenFromJuyou);



  router.get('/v1/pn/dlq', controller.common.getFun);
  router.get('/v1/pn/setsqltoredis', controller.common.setSqlToRedis);


  router.get('/v1/un/getcookies', controller.wxauth.getcookies);
  router.get('/v1/un/clearinfo', controller.wxauth.clearinfo);
  router.get('/v1/un/getuserinfo', controller.wxauth.getUserInfo);
  router.get('/v1/un/getwxauthpath', controller.wxauth.getWXAuthPath);


  router.get('/v1/un/checkneedauthtest', controller.wxauth.checkNeedAuth);
  router.get('/v1/un/authtest', controller.wxauth.auth1);
  router.get('/v1/un/getwxcodetest', controller.wxauth.getwxcode);

  //router.post('/MP_verify_T1LLNeCSL4P8T9Bw.txt', controller.member.file);
  

  //api/v2/ads


};
